package it.hive.controller.listener;

import it.hive.controller.task.Animazione;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.scene.control.Button;
import javafx.scene.control.ProgressIndicator;

public class EndDownloadListener implements ChangeListener<Boolean> {
	private volatile ProgressIndicator progressIndicator;
	// private boolean animazioneAvviata = false;
	private volatile Button download;

	public EndDownloadListener(ProgressIndicator progressIndicator, Button download) {
		this.progressIndicator = progressIndicator;
		this.download = download;
	}

	@Override
	public void changed(ObservableValue<? extends Boolean> arg0, Boolean arg1, Boolean arg2) {
		if (arg2 != null && arg2) {
			// progressIndicator.progressProperty().unbind();
			// TODO
			Animazione.switchAnimazione(progressIndicator, download, 4);
		}
	}
}
